/**
 * @param {number} num
 * @return {boolean}
 */
export var isPerfectSquare = function (num) {
  let left = 1,
    right = num
  while (left <= right) {
    const mid = left + Math.floor((right - left) / 2)
    const square = mid * mid
    if (square === num) return true
    if (square > num) right = mid - 1
    else left = mid + 1
  }
  return false
}
